package com.qingyouchuxing.mall.biz.domain.dto;

import com.qingyouchuxing.mall.biz.domain.bo.MallGoodsSpuBO;
import com.qingyouchuxing.mall.biz.domain.entity.MallGoods;
import com.qingyouchuxing.mall.biz.domain.entity.MallGoodsSpu;
import com.ruoyi.common.core.validate.EditGroup;
import io.github.linpeilie.annotations.AutoMapper;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.math.BigDecimal;
import java.util.List;

/**
 * 商品表单DTO
 */
@Data
@EqualsAndHashCode(callSuper = false)
@AutoMapper(target = MallGoods.class, reverseConvertGenerate = false)
public class MallGoodsFromDTO {

    /**
     * 商品id
     */
    @NotNull(groups = EditGroup.class)
    private Long id;

    /**
     * 商品名称
     */
    @NotBlank(message = "商品名称不能为空")
    private String goodsName;

    /**
     * 商品分类
     */
    @NotNull(message = "商品分类不能为空")
    private Long fkClassifyId;

    /**
     * 主图地址
     */
    @NotEmpty(message = "商品主图不能为空")
    private List<String> imageList;

    /**
     * 详情页图片
     */
    private List<String> infoImageList;

    /**
     * 价格
     */
    @NotNull(message = "价格不能为空")
    @Min(0)
    private BigDecimal price;

    /**
     * 销售价
     */
    @Min(0)
    private BigDecimal salePrice;

    /**
     * 运费
     */
    @NotNull(message = "运费不能为空")
    private BigDecimal freightPrice;

    /** VIP价格 */
    private BigDecimal vipPrice;

    /** 商品描述(包含配料详情) */
    private String desc;

    /** 品牌名称 */
    private String brandName;
    /**
     * 相关spu
     */
    @NotEmpty(message = "必须填写spu")
    private List<MallGoodsSpuBO> spuList;

    /**
     * 需要删除的spuId
     */
    private List<Long> deleteSpuIds;

    /**
     * 需要删除的skuId
     */
    private List<Long> deleteSkuIds;

    /**
     * 乐观锁
     */
    private Integer version;
}
